import { TopicType } from "@/utils/enums";

interface TeacherType {
  teacherId?: number;
  userName: string;
  realName: string;
  teacherPass: string;
  /** 所教课程集合 */
  courseIds: number[];
  /** 所教专业集合 */
  majorIds: number[];
  /** 所教班级集合 */
  classIds: number[];
  /**
   * 操作类型
   * 1：新增，2：编辑
   */
  opt: number;
  teacherStatus?: number;
}

interface LabelType {
  /**
   * 标签id
   */
  labelId?: number;
  /**
   * 标签名称
   */
  labelName?: string;
  /**
   * 标签状态
   */
  labelStatus?: number;
}

interface ObjectiveType {
  questionId: number;
  /** 题目编号 */
  questionCode: string;
  /** 题目类型 */
  questionType: string;
  /** 课程id */
  courseId: string;
  /** 课程名称 */
  courseName: string;
  questionStem: string;
  labels: {
    labelId: number;
    labelName: string;
  }[];
  createTime: string;
  updateTime: string;
}

interface RecommonObjectiveType extends ObjectiveType {
  studentId?: number;
  studentName?: string;
  studentNo?: string;
  /** 年级 */
}

interface RecommonOperateType extends OperationType {
  studentId?: number;
  studentName?: string;
  studentNo?: string;
  /** 年级 */
}

interface OperationType {
  exerciseId: string;
  /** 操作题类型 */
  exerciseType: string;
  /** 操作题编码 */
  exerciseCode: string;
  exerciseInfo: string;
  /** 题干 */
  exerciseStem: string;
  /** 知识点标签集合 */
  labels: {
    labelId: number;
    labelName: string;
  }[];
  createTime: string;
  updateTime: string;
}

interface ClassType {
  /**
   * 年级
   */
  classGrade: number;
  classId: number;
  /**
   * 队别号
   */
  classTeam: number;
  /**
   * 区队号
   */
  classUnit: number;
  /**
   * 专业id
   */
  majorId: number;
  /**
   * 专业名称
   */
  majorName: string;
}

interface StudentType {
  classGrade: number;
  classTeam: number;
  classUnit: number;
  majorId: string;
  majorName: string;
  studentId: number;
  studentName: string;
  studentNo: string;
}

interface PaperType {
  /**
   * 所属课程id
   */
  courseId: string;
  paperType?: number;
  /**
   * 所属课程名称
   */
  courseName: string;
  createTime: string;
  /**
   * 操作题数量
   */
  exerciseCount: string;
  paperId: string;
  /**
   * 试卷名称
   */
  name: string;
  /**
   * 客观题数量
   */
  questionCount: string;
  /**
   * 总分
   */
  score: string;
  updateTime: string;
}

interface ExamType {
  /** 考试 id */
  id: number;
  /** 考试名称 */
  name: string;
  /** 试卷id */
  paperId: number;
  /** 试卷名称 */
  paperName: string;
  /** 班级 id */
  classId: number;
  /** 年级 */
  grade: number;
  /** 队号 */
  team: string;
  /** 区队号 */
  unit: string;
  /** 考试时长(单位分钟) */
  duration: string;
  /** 实际开始时间 */
  realStartTime: string;
  /** 剩余分钟 */
  remainMinutes: number;
  /** 剩余秒数 */
  remainSeconds: number;
  /** 待开始、进行中、结束 */
  statusStr: string;
  studentId?:string
}

interface AddEditProps {
  editData?: any;
  onSuccess?: (params?: any) => void;
  trigger?: React.ReactNode;
}

type OperationAddType = {
  exerciseId?: number;
  /** 操作题类型 */
  exerciseType?: number;
  /** 操作题编码 */
  exerciseCode?: string;
  /** 所属课程id */
  courseId?: number;
  /** 题目标题(富文本） */
  exerciseInfo?: string;
  /** 解题提示 */
  exercisePrompt?: string;
  /** 知识点标签 */
  labelIds?: number[];
  exerciseSteps?: {
    exerciseStepId?: number;
    stepDesc?: string;
    stepOrder?: number;
    /** 富文本补充说明 */
    stepRichText?: string;
    stepKnowledges?: {
      knowledgeId?: string;
      knowledgeOrder?: number;
      parameterValues?: {
        parameterIndex?: number;
        parameterValue?: string;
      }[];
    }[];
  }[];
  /**
   * 字处理、电子表格、演示文稿的原始素材
   * 存的是url
   */
  exerciseRawFile: string;
  /**
   * 答案文件
   * 存的是url
   */
  exerciseAnswer: string;
  opt: number;
};

interface ObjectFormProps {
  questionId?: number;
  /** 题目标号 */
  questionCode: string;
  /**
   * 客观题类型
   * 题目类型，1：填空题，2：选择题，3：判断题，4：问答题
   */
  questionType: number;
  /** 题干 */
  questionStem: string;
  /** 所属课程id */
  courseId: number;
  /**
   * 填空题和问答题答案
   * 逗号隔开
   */
  answerContent: string;
  /** 判断题答案 */
  answerTf: number;
  /** 选择题答案 */
  answerChoice: string;
  answerAnalysis: string;
  labelIds: {
    labelId: number;
  }[];
  options: {
    /** abcd */
    opionSgin: string;
    /** 选项内容 */
    opionContent: string;
  }[];
}

interface TextRecordType {
  examId?: string;
  examName?: string;
  realStartTime?: string;
  realEndTime?: string;
  /** 填空题得分 */
  fbQuestionScore?: number;
  /** 选择题得分 */
  mcQuestionScore?: number;
  /** 判断题得分 */
  tfQuestionScore?: number;
  /** 问答题得分 */
  qaQuestionScore?: number;
  /** 基本操作题得分 */
  basicExerciseScore?: number;
  /** 字处理操作题得分 */
  wordExerciseScore?: number;
  /** 电子表格操作题得分 */
  excelExerciseScore?: number;
  /** 演示文稿操作题得分 */
  pptExerciseScore?: number;
  /** 总分 */
  totalScore?: number;
}

interface ExamChartProps {
  /**
   * 优秀人数
   */
  excellentCount: number;
  /**
   * 优秀占比
   */
  excellentRate: number;
  /**
   * 不及格人数
   */
  failCount: number;
  /**
   * 不及格占比
   */
  failRate?: number;
  /**
   * 良好人数
   */
  goodCount: number;
  /**
   * 良好占比
   */
  goodRate: number;
  /**
   * 及格人数
   */
  passCount: number;
  /**
   * 及格占比
   */
  passRate: number;
  [property: string]: any;
}

interface ObjectiveOption {
  optionSign?: string;         // 选项标识，如"A"
  optionContent?: string;      // 选项内容
  optionId?: number;           // 选项ID
}

interface ObjectiveTopicType {
  questionId?: number;         // 题目ID
  questionCode?: string;       // 题目编号
  questionType?: number;       // 题目类型
  questionStem?: string;       // 题干
  courseId?: number;           // 课程ID
  questionStatus?: number;     // 题目状态
  createTime?: string;         // 创建时间
  updateTime?: string;         // 更新时间
  options?: ObjectiveOption[]; // 选项列表
  labels?: string[];           // 标签
  answerAnalysis?: string;     // 答案解析
  answerChoice?: string;       // 正确答案
  createBy?: string;           // 创建人
  updateBy?: string;           // 更新人
}

export type {
  ObjectiveTopicType,
  ExamChartProps,
  RecommonOperateType,
  RecommonObjectiveType,
  TextRecordType,
  ObjectFormProps,
  OperationAddType,
  TeacherType,
  LabelType,
  ObjectiveType,
  OperationType,
  ClassType,
  StudentType,
  PaperType,
  AddEditProps,
  ExamType,
};


export interface ExerciseLabel {
  labelId?: number;
  labelName?: string;
  labelStatus?: number;
}

export interface StepParameterValue {
  stepParameterValueId?: number;
  stepKnowledgeId?: number;
  parameterIndex?: number;
  parameterValue?: string;
}

export interface ExerciseStepKnowledge {
  stepKnowledgeId?: number;
  exerciseStepId?: number;
  knowledgeId?: number;
  knowledgeType?: number;
  knowledgeOrder?: number;
  knowledgeDesc?: string;
  parameterValues?: StepParameterValue[];
}

export interface ExerciseStep {
  exerciseStepId?: number;
  stepDesc?: string;
  stepPics?: string;
  stepKnowledges?: ExerciseStepKnowledge[];
}

export interface OperationExerciseType {
  exerciseId?: number;
  exerciseType?: number;
  exerciseCode?: string;
  exerciseInfo?: string;
  courseId?: number;
  exerciseSource?: number;
  exerciseStatus?: number;
  exerciseRawFile?: string;
  exercisePrompt?: string;
  exerciseAnswer?: string;
  labels?: ExerciseLabel[];
  exerciseSteps?: ExerciseStep[];
}

export interface TopicItem {
  id?: number;
  type?: TopicType;
  question?: string;
  score?: number;
  exerciseSteps?: any[];
  [key: string]: any;
}